

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.TreeMap;

public class TcpServer {

	public static ArrayList<Socket> socketList=new ArrayList<Socket>();
	//static TreeMap<Integer, String> tree = new TreeMap<Integer, String>();
	static int count = 1;
	public static void main(String[] args){
		PrintChessboard pc =new PrintChessboard(10,10);
		try{
		int serverPort=2345;
		int clientCount=1;
		ServerSocket server =new ServerSocket(serverPort);
		String[][] pcc = pc.chessBoard();
		while(true){
			if(socketList.size()<2){
				Socket clientSocket=server.accept();
				socketList.add(clientSocket);
				new Thread(new ServerThread(clientSocket,clientCount,pc)).start();
				clientCount++;
			}else{
				server.close();
			}
		}
		}catch(Exception e){
			System.out.println(e);
		}
       
	}

}
